package com.controller;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.bean.action;
import com.dao.staffDao;

/**
 * Servlet implementation class addAction
 */
@WebServlet("/addAction.do")
public class addAction extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public addAction() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		//response.getWriter().append("Served at: ").append(request.getContextPath());
		String id = request.getParameter("id");
		String country = request.getParameter("country");
		String college = request.getParameter("college");
		String subject = request.getParameter("subject");
		String outdate = request.getParameter("outdate");
		String backdate = request.getParameter("backdate");
		String costby = request.getParameter("costby");
		String remake = request.getParameter("remake");
		String outtype = request.getParameter("outtype");
		String job = request.getParameter("job");
		String adl = request.getParameter("adl");
		String post = request.getParameter("post");
		
		action a = new action();
		staffDao dao = new staffDao();
		a.setBackdate(backdate);
		a.setFpid(id);
		a.setCollege(college);
		a.setCountry(country);
		a.setSubject(subject);
		a.setOutdate(outdate);
		a.setRemake(remake);
		a.setCostby(costby);
		a.setJob(job);
		a.setAdl(adl);
		a.setPost(post);
		a.setOuttype(outtype);
		
		dao.addAction(a);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
